package com.huaju.enity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Backuprecord entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "backuprecord", catalog = "licai")
@JsonIgnoreProperties(value={"recoverrecords"})
public class Backuprecord implements java.io.Serializable {

	// Fields

	private Integer recordId;
	private String path;
	private Date createDate;
	private Set<Recoverrecord> recoverrecords = new HashSet<Recoverrecord>(0);

	// Constructors

	/** default constructor */
	public Backuprecord() {
	}

	/** full constructor */
	public Backuprecord(String path, Date createDate,
			Set<Recoverrecord> recoverrecords) {
		this.path = path;
		this.createDate = createDate;
		this.recoverrecords = recoverrecords;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "record_id", unique = true, nullable = false)
	public Integer getRecordId() {
		return this.recordId;
	}

	public void setRecordId(Integer recordId) {
		this.recordId = recordId;
	}

	@Column(name = "path")
	public String getPath() {
		return this.path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	@Column(name = "create_date", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss" ) 
    @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss" ,timezone = "GMT+8")
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "backuprecord")
	public Set<Recoverrecord> getRecoverrecords() {
		return this.recoverrecords;
	}

	public void setRecoverrecords(Set<Recoverrecord> recoverrecords) {
		this.recoverrecords = recoverrecords;
	}

}